<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 分时显示不同问候语 -->
        <div id="greeting">
                    <p>Good Morning!</p>
        </div>
        <script>
            // 获取当前时间
            var now = new Date();
            // 获取小时数
                var hours = now.getHours();
            // 根据小时数设置问候语
            if (hours < 12) {
                    document.getElementById("greeting").innerHTML = "<p>早上好!</p>";
            } else if (hours >= 12 && hours < 18) {
                document.getElementById("greeting").innerHTML = "<p>下午好</p>";
            } else {
                document.getElementById("greeting").innerHTML = "<p>晚上好</p>";
                    }

        </script>
</body>
</html>